Habits allow for the fast, fluid, nearly effortless execution of complex tasks, yet they can also be detrimental, for example in cases where they lead to compulsive behaviors such as in obsessive-compulsive disorder (OCD) or to behavioral patterns of drug abuse and relapse in addiction. Habit formation requires two reciprocally connected brain areas: the striatum, the input nucleus of the Basal Ganglia, and the substantia nigra (SN), which provides modulatory dopaminergic signals to the striatum. Decades of research on humans, monkeys and rodents have shown that different regions of striatum have different roles in habit formation. Initial task acquisition, which is goal-directed, is mediated b the dorsomedial striatum, while habit formation is mediated by the dorsolateral striatum. How can these two regions of striatum, which are very similar in their gross physiology and anatomy, support these two very different behavioral modes? One hypothesis, explored in this proposal, is that the connectivity motifs - the specific relationships between the inputs and the outputs - o the striatum and the SN differ by region. The long-term objective of this research will be to establish a functional input-output connectivity map of SN dopamine neurons that elucidates the diverse projection-specific functions of these neurons as an animal undergoes habit formation. In service of this overarching objective, three specific, immediately achievable aims are proposed, each of which is made possible by a recently developed technological approach. The approaches are (1) TRIO, a rabies-based circuit mapping technology that allows the simultaneous study of the inputs and outputs of a brain region of interest, (2) slice electrophysiology in combination with optogenetics, allowing for functional circuit mapping and (3) in vivo photometry, permitting the detection of calcium indicator fluorescence from subsets of SN dopamine neurons defined by their output in order to measure the activity of specific circuit elements in freely behaving animals. Together, these approaches will yield new insights into the structure and function of striatonigrostriatal circuit elements during the process of habit formation.